package com.itzxx.huazhun.data.model

/**
 * Desc:
 *
 * Author: zhangxiaoxiao
 * Date: 2024/7/28 11:18
 * Copyright: Copyright (c) 2006-2024
 * Company: @海晟融创
 * Updater:
 * Update Time:
 * Update Comments:
 */
data class CoordinatorInfo(
    val coordinatorMac: String,
    val holeNum: Int,
    val hw: Int,
    val model: String,
    val probe: String,
    val probeNum: Int,
    val sw: Int
)

data class ProbeStateInfo(
    val holeIndex: String,
    var probeMac: String = "",
    var serialNumber: String = "",
    //如果空，正常是1(空闲准备就绪)，采集中2，采集完成3  4,失败
    var state: Int = 0
) {
    var probeInfo: ProbeInfo? = null
    var probeTestingInfo: ProbeTestingInfo? = null
    var activationTime = 0
    var readUpdateTime = 0L//更新时间

    var errorNum = 0;


    //刷新最新时间
    fun refreshReadTime() {
        readUpdateTime = System.currentTimeMillis()
    }

    //默认2秒
    fun isReadTimeout(): Boolean {
        return (System.currentTimeMillis() - readUpdateTime) >= 1 * 1000
    }

    //异常重试超标
    fun isErrorResetOut(): Boolean {
        errorNum = errorNum.plus(1)
        return errorNum > 5
    }

}